
package com.rt.schedulenew.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rt.schedulebase.dto.DictSexDto;
import com.rt.schedulebase.entity.DictSex;
import com.rt.schedulebase.mapper.DictSexMapper;
import com.rt.schedulenew.api.IDictSexService;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class DictSexServiceImpl extends ServiceImpl<DictSexMapper, DictSex> implements IDictSexService {
    @Override
    public boolean insertSelective(DictSex dictSex) {
        return retBool(baseMapper.insert(dictSex));
    }

    @Override
    public boolean deleteByPrimaryKey(String key) {
        return retBool(baseMapper.deleteById((Serializable) key));
    }

    @Override
    public boolean updateByPrimaryKeySelective(DictSex dictSex) {
        return retBool(baseMapper.updateById(dictSex));
    }

    @Override
    public DictSex selectByPrimaryKey(String key) {
        return baseMapper.selectById((Serializable) key);
    }

    @Override
    public List<DictSex> getList(DictSexDto dto) {
        QueryWrapper<DictSex> qw = new QueryWrapper<>();
        Map<String, Object> map = new HashMap<>();
        qw.allEq(map, false);
        List<DictSex> list = baseMapper.selectList(qw);
        return list;
    }

    @Override
    public List<DictSex> getListAll() {
        return baseMapper.selectList(null);
    }

    @Override
    public boolean delete(DictSex dictSex) {
        UpdateWrapper<DictSex> uw = new UpdateWrapper<>();
        Map<String, Object> map = new HashMap<>();
        uw.allEq(map, false);
        return retBool(baseMapper.delete(uw));
    }

    @Override
    public boolean update(DictSex dictSex) {
        UpdateWrapper<DictSex> uw = new UpdateWrapper<>();
        Map<String, Object> map = new HashMap<>();
        uw.allEq(map, false);
        return retBool(baseMapper.update(dictSex, uw));
    }

    @Override
    public DictSex getInfo(DictSexDto dto) {
        QueryWrapper<DictSex> qw = new QueryWrapper<>();
        Map<String, Object> map = new HashMap<>();
        qw.allEq(map, false);
        return baseMapper.selectOne(qw);
    }
}
